package com.zmn.oms.admin.controller.conf.orderduty;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.model.entity.conf.orderduty.OrderDuty;
import com.zmn.oms.model.entity.conf.orderduty.OrderDutyQuery;
import com.zmn.oms.services.interfaces.conf.orderduty.OrderDutyService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类描述： 预约设置基础查询
 *
 * @author liuying
 * @date 2022/03/09 18:23
 */
@RestController
@RequestMapping("/conf/orderduty/")
public class OrderDutyListController extends DutyBaseController {

    @Resource
    private OrderDutyService orderDutyService;

    /**
     * 列表
     */
    @RequestMapping("list")
    //@RequiresPermissions("/conf/orderduty/list.action")
    public ModelAndView list(@ModelAttribute OrderDutyQuery query) {

        ModelAndView mav = new ModelAndView("conf/orderduty/list");
        mav.addObject("vo", query);
        return mav;
    }

    /**
     * 列表
     */
    @RequestMapping("listQuery")
    @ResponseBody
    public ResponseDTO<List<OrderDuty>> listQuery(@RequestBody OrderDutyQuery query) {

        List<OrderDuty> items = orderDutyService.listByQuery(query);
        return ResponseDTO.success(items, "查询成功");
    }

}
